//#include <iostream>
//#include "mpHttpClient.h"
//#include "Mapper/mp_http_send_complete_callback.h"
//#include "Mapper/mpFishMapper.h"

//using namespace MP::HTTP;

//void http_async(){

//    boost::asio::io_context context;

//    //创建HttpClient并设置URL基地址
//    HttpClientAsync::ptr_s client = createHttpClientAsync(context);
//    client->getBaseAddress().setBaseUrl("https://localhost:5001/");

//    //异步执行多个请求
//    client->getAsync("/api/fish",http_send_complete_callback("fish"));
//    client->getAsync("/api/fish/9527",http_send_complete_callback("fish"));
//    client->getAsync("/api/fish/9528",http_send_complete_callback("fish"));

//    context.run();
//}


//void http_download(){

//    //创建HttpClient并设置URL基地址
//    HttpClient::ptr_s client = createHttpClient();
//    client->getBaseAddress().setBaseUrl("https://localhost:5001/");

//    //文件路径下载后保存的路径
//    std::string path = MP::FileUtils::get_appdir() + PATH_DELIM + "tmp.jpg";
//    //执行下载请求
//    bool isSuccess = client->download("/api/filesystem/download_img.jpg",path);

//    std::cout << isSuccess;
//}


//void http_post_form(){

//    //创建HttpClient并设置URL基地址
//    HttpClient::ptr_s client = createHttpClient();
//    client->getBaseAddress().setBaseUrl("https://localhost:5001/");

//    //待上传的文件路径
//    std::string path = MP::FileUtils::get_appdir() + PATH_DELIM + "test_form.jpg";

//    //创建Http 表单请求内容
//    HttpRequestMultipartContent::ptr_s req_form_content = createHttpRequestMultipartContent();
//    req_form_content->addFormData("Message","just for test");
//    req_form_content->addFormData("Message2","just for test 2");
//    req_form_content->addFormFile("test_form.jpg","test_form.jpg",path);

//    //执行Http请求并获得返回值HttpResponseMessage
//    HttpResponseMessage::ptr_s rep_form = client->post("/api/filesystem/UploadFormModel",req_form_content);

//    //检查请求是否执行成
//    std::cout << rep_form->isSuccess();
//}

//void http_post(){

//    //创建HttpClient并设置URL基地址
//    HttpClient::ptr_s client = createHttpClient();
//    client->getBaseAddress().setBaseUrl("https://localhost:5001/");

//    //定义一个结构体
//    FishInfo fish;
//    fish_post.Id = 3306;
//    fish_post.Name = "三文鱼";
//    fish_post.Pinyin = "sanwenyu";
//    fish_post.IsLivingInSea = true;

//    //将结构体转换为json字符串
//    std::string json;
//    MP::Mapper::objectMapperToJsonString(fish_post,json);

//    //创建Http请求内容
//    HttpRequestContent::ptr_s requestContent = createHttpRequestJsonContent(json);
//    //执行Http请求并获得返回值HttpResponseMessage
//    HttpResponseMessage::ptr_s rep_post = client->post("/api/fish",requestContent);

//    //检查请求是否执行成
//    std::cout << rep_post->isSuccess();
//}


//void http_get(){

//    HttpClient::ptr_s client = createHttpClient();
//    client->getBaseAddress().setBaseUrl("https://localhost:5001/");

//    HttpResponseMessage::ptr_s resp = client->get("/weatherforecast");
//    std::string result = resp->getHttpResponseContent()->getData();

//    std::cout << result;
//}
